import * as actionTypes from './constants'

import { getTopList } from '@/services/ranking'

const changeRankList = res => ({
  type: actionTypes.RANKLIST,
  rankList: res.list
})

export const getRankListAction = () => {
  return dispatch => {
    getTopList().then(res => {
      dispatch(changeRankList(res))
    })
  }
}